package cc.autoapi.pucong.auto.flow.core.flow.execNode.entity.task;

import cc.autoapi.pucong.auto.flow.core.flow.execNode.selfenum.RunStatusEnum;
import lombok.Data;

import java.io.Serializable;

@Data
public class NodeExecResult implements Serializable {

    private static final long serialVersionUID = 1L;

    private String errorLog;

    private RunStatusEnum runStatus;

    public NodeExecResult(RunStatusEnum runStatus) {
        this.runStatus = runStatus;
    }


    public NodeExecResult(String errorLog, RunStatusEnum runStatus) {
        this.errorLog = errorLog;
        this.runStatus = runStatus;
    }

    public static NodeExecResult ready() {
        return new NodeExecResult(RunStatusEnum.未执行);
    }

    public static NodeExecResult ok() {
        return new NodeExecResult(RunStatusEnum.执行成功);
    }

    public static NodeExecResult ignore() {
        return new NodeExecResult(RunStatusEnum.已跳过);
    }

    public static NodeExecResult error(String error) {
        return new NodeExecResult(error, RunStatusEnum.执行失败);
    }
}
